<template>
  <div>
    app组件 <br />
    获取子组件内容== {{ content }} ====={{ obj }}
    <button @click="say()">调用函数</button>
    <h1 ref="h">我是h1标签</h1>
    <hr />
    <ref ref="readson"> </ref>
  </div>
</template>
<script>
import ref from './ref&refs/ref.vue'
export default {
  components: { ref },
  name: '',
  data () {
    return {
      content: '',
      obj: {},
    }
  },
  created () {
    this.say()
  },
  computed: {
  },
  methods: {
    say () { }
  },
  //dom加载完成后
  mounted () {
    //固定语法搭配,属性绑定ref+this.$refs获取组件实例
    // console.log(this.$refs.readson);
    console.log(this.$refs.readson.text);
    this.content = this.$refs.readson.text
    this.obj = this.$refs.readson.obj
    this.say = this.$refs.readson.say
    this.$refs.readson.text = '121212'
    //同时可以获取dom元素,注意要在当前dom加载完成后
    this.$refs.h.style.color = 'red'
  }
}
</script>
<style lang='less'  scoped>
</style>
